/* eslint global-require: 0 redux state数据配置，*/
import thunk from "redux-thunk";
import { combineReducers, createStore, applyMiddleware, compose } from "redux";

import Order from "@/reducers/Order";
// import Barmaid from "./reducers/Barmaid";
// import BarmaidAdmin from "./reducers/BarmaidAdmin";
// import Home from "./reducers/Home";
// import Registration from "./reducers/Registration";
// import Room from "./reducers/Room";
// import User from "./reducers/User";
// import Manager from "./reducers/Manager" 
//多个store合并成一个 reducer 组合
const reducer = combineReducers({ Order });
let updateStore = f => f;
const middlewares = [thunk];
let enhancer = applyMiddleware(...middlewares);
export default function configureStore(initialState) {
  /**
   * createStore() 的第二个参数是可选的, 
   * 用于设置 state 初始状态。这对开发同构应用时非常有用，
   * 服务器端 redux 应用的 state 结构可以与客户端保持一致, 
   * 那么客户端可以将从网络接收到的服务端 state 直接用于本地数据初始化。
   */
  const store = createStore(reducer, initialState, enhancer);
  updateStore(store);
  return store;
}
